const path = require("path");
const isDev = think.env === "development";
const cors = require("@koa/cors");
module.exports = [
  // {
  //   handle: "trace",
  //   enable: !think.isCli,
  //   options: {
  //     debug: isDev,
  //     templates: {
  //       404: path.join(think.ROOT_PATH, "view/common/error_404.html"),
  //       500: path.join(think.ROOT_PATH, "view/common/error_404.html"),
  //     },
  //   },
  // },
  {
    handle: "meta",
    options: {
      logRequest: isDev,
      sendResponseTime: isDev,
    },
  },
  {
    handle: cors,
    options: {},
  },
  {
    handle: "trace",
    enable: !think.isCli,
    options: {
      debug: isDev,
    },
  },
  {
    handle: "payload",
    options: {
      keepExtensions: true,
      limit: "5mb",
      maxFileSize:"1000mb"
    },
  },
  {
    handle: "router",
    options: {},
  },
  // {
  //   handle: 'resource',
  //   enable: isDev, // 是否开启当前中间件
  //   options: {
  //     root: path.join(think.ROOT_PATH, 'www'),
  //     publicPath: /^\/(static|favicon\.ico)/,
  //   },
  // },
  "logic",
  "controller",
];
